package com.elitesland.b2c.com.entity;

import com.elitesland.core.base.BaseModel;
import com.elitesland.system.annotation.Comment;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Index;
import javax.persistence.Table;
import java.io.Serializable;

/**
 * .
 *
 * @author Kaiser（wang shao）
 * @date 2021-02-01
 */
@Entity
@Table(name = "com_area",
        indexes = {
                @Index(name = "idx_com_area_name", columnList = "name"),
                @Index(name = "idx_com_area_parent_id", columnList = "parent_id")
        })
@org.hibernate.annotations.Table(appliesTo = "com_area", comment = "区域设置")
@Data
@DynamicInsert
@DynamicUpdate
@EqualsAndHashCode(callSuper = true)
public class ComAreaDO extends BaseModel implements Serializable {

        private static final long serialVersionUID = 6321202318501264368L;

        @Comment("区域名称")
        @Column(name = "name", columnDefinition = "varchar(256)", nullable = false)
        private String name;

        @Comment("上级ID")
        @Column(name = "parent_id", columnDefinition = "bigint(20)", nullable = false)
        private Long parentId;

        @Comment("分类 UDC[COM:AREA_CATEGORY] （PROVINCE：省份，CITY：市，COUNTY：县（区），STREET：乡、镇、街道）")
        @Column(name = "category", columnDefinition = "varchar(64)", nullable = false)
        private String category;

        @Comment("顺序号")
        @Column(name = "sort_no", columnDefinition = "int(4) default 0")
        private Integer sortNo;

        @Comment("是否启用")
        @Column(name = "enabled", columnDefinition = "tinyint(1) default 0")
        private Boolean enabled;
}
